//
//  RZQCuriousSayCollectionCell.m
//  LastOne
//
//  Created by dllo on 15/11/6.
//  Copyright © 2015年 sc. All rights reserved.
//

#import "RZQCuriousSayCollectionCell.h"
#import "FitHeader.h"
#import <UIImageView+WebCache.h>
#import "NightHeader.h"
@implementation RZQCuriousSayCollectionCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatAction];
        
       self.contentView.backgroundColor = [UIColor colorWithRed:arc4random()% 256 / 255.0 green:0.6 blue:arc4random()% 256 / 255.0 alpha:1];
    }
    return self;
}
-(void)creatAction
{
        _Flag = 0;
    _headImage = [[UIImageView alloc]initWithFrame:CGRectMake(5 * FitWidth, 5 * FitHeight, 20 * FitWidth, 20 * FitHeight)];
    _headImage.layer.cornerRadius = _headImage.frame.size.width / 2;
    _headImage.clipsToBounds = YES;
    [self.contentView addSubview:_headImage];
    
    _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(30 * FitWidth, 5 * FitHeight, 150 * FitWidth, 20 *FitHeight)];
    [self.contentView addSubview:_nameLabel];
    
    _messageLabel = [[UILabel alloc]initWithFrame:CGRectMake(5 * FitWidth, 30 * FitHeight , 150 * FitWidth, 160 * FitHeight)];
    [self.contentView addSubview:_messageLabel];
    
    
    _zanLabel = [[UILabel alloc]initWithFrame:CGRectMake(10 * FitWidth,  200 * FitHeight, 150 * FitWidth, 30 * FitHeight)];
    _zanLabel.layer.cornerRadius = 10;
    _zanLabel.layer.borderWidth = 2.0;
    _zanLabel.userInteractionEnabled = YES;
    _zanLabel.layer.borderColor = [UIColor whiteColor].CGColor;
    [self.contentView addSubview:_zanLabel];
    
//    _zanImage = [[UIImageView alloc]initWithFrame:CGRectMake( _zanLabel.frame.size.width + 5 * FitWidth, 0 * FitHeight, 30 * FitWidth , 30 * FitHeight)];
//    _zanImage.image = [UIImage imageNamed:@"iconfont-zan"];
    [_zanLabel addSubview:_zanImage];
 
    
}
-(void)layoutSubviews
{
    [super layoutSubviews];
}
-(void)setModelData:(SayModel *)modelData
{
    if (_modelData != modelData) {
        _modelData = modelData;
        
    }
   
    [_headImage sd_setImageWithURL:[NSURL URLWithString:[_modelData.author objectForKey:@"avatar"]]];

    _nameLabel.text = [_modelData.author objectForKey:@"name"];
    _nameLabel.textColor = [UIColor whiteColor];
    _nameLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:18];
    _messageLabel.text = _modelData.content;
    
    _messageLabel.textColor = [UIColor whiteColor];
    _messageLabel.textAlignment = 1;
    _messageLabel.numberOfLines = 0;
    _messageLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:18];

    
  
    _zanLabel.text = [NSString stringWithFormat:@"%ld 人赞过", (long)_modelData.praise_count];
    _zanLabel.textColor = [UIColor whiteColor];
    _zanLabel.textAlignment =  YES;
    _zanLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:16];

   
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
